﻿using System;
using System.Collections.Generic;
using System.Text;
using MiragePWF.Common.Commons;

namespace Wolfut.MirageEE.Kernal.Common
{
    public class ServiceProxyBase
    {
        protected string SessionId
        {
            get
            {
                return sessionId;
            }
            set
            {
                sessionId = value;
            }
        }
        protected string ObjectURI
        {
            get
            {
                return objectUri;
            }
            set
            {
                objectUri = value;
            }
        }

        private string objectUri;
        private string sessionId;
        private string GetRealUrl(string uri)
        {
            //return string.Format()
            string servicePath = FrameworkConfig.ObjectUri;
            return String.Format(servicePath, uri);
        }
        public ServiceProxyBase()
        {
            
        }

        public ServiceProxyBase(string sessionId )
        {
            this.SessionId = sessionId;
        }
        protected object GetInterface(Type interfaceType,string objectUrl)
        {
            return Activator.GetObject(interfaceType, GetRealUrl(objectUrl));
        }
        public virtual IApplicationContext ApplicationContext
        {
            get { return ApplicationContextFactory.GetApplicationContext(); }
        }
    }
}
